/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.MOS.javacc.applications;

import com.sun.dtv.lwuit.Display;
import java.awt.Container;
import javax.microedition.xlet.UnavailableContainerException;
import javax.microedition.xlet.XletContext;
import java.util.UUID;


/**
 *
 * @author Leonardo Baptista (cbs)
 */
public class ApplicationContext implements XletContext {

    public final int STATUS_DESTROYED = 0;
    public final int STATUS_PAUSED = 1;
    public final int STATUS_ALIVE = 2;
    public final int STATUS_REQUEST_ALIVE = 3;

    private int status;
    private UUID id;


    public ApplicationContext(){
        status = STATUS_REQUEST_ALIVE;
        id = UUID.randomUUID();
    }

    public int getStatus(){
        return status;
    }

    public String getID(){
        return id.toString();
    }

    public void notifyDestroyed() {
        status =  STATUS_DESTROYED;
        ApplicationManager.killXlets(getID());
    }

    public void notifyPaused() {
        status = STATUS_PAUSED;
        Display.getInstance().getCurrent().setVisible(false);
    }

    public Object getXletProperty(String key) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void resumeRequest() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Container getContainer() throws UnavailableContainerException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public ClassLoader getClassLoader() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
